<?php
/*
 * 一键登录管理
 * @arrange Mark
 * @package ixdcw
 * @file    oauth.inc.php
 * @time    12-12-19 上午11:58
 */
defined('IN_IXDCW') or exit('Access Denied');
login();
require DT_CORE.'/'.$module.'/common.inc.php';
require_once DT_INC.'/post.func.php';
switch($action) {
	case 'delete':
		$itemid or Prompt::message();
		$U = $db->getOne("SELECT * FROM {$db->getPre()}oauth WHERE itemid=$itemid");
		if(!$U || $U['username'] != $_username) Prompt::message();
		$db->query("DELETE FROM {$db->getPre()}oauth WHERE itemid=$itemid");
		dmsg($L['oauth_quit'], 'oauth.php');
	break;
	default:
		$lists = array();
		$result = $db->query("SELECT * FROM {$db->getPre()}oauth WHERE username='$_username'");
		while($r = $db->fetchArray($result)) {
			$r['adddate'] = timetodate($r['addtime'], 5);
			$r['logindate'] = timetodate($r['logintime'], 5);
			$r['nickname'] or $r['nickname'] = '-';
			$lists[$r['site']] = $r;
		}
		$OAUTH = PCache::read('oauth.php');
		$head_title = $L['oauth_title'];	
	break;
}
include template('oauth', $module);
?>